<div>
    <span class="brand" style="font-weight:bold;">{{serverAssignDialogData.title}}</span>
    <div class="card" style="margin-top: 20px;margin-bottom: 10px;">
        <div class="panel-body">
            <div class="row">
                <form class="form-horizontal" role="form">
                    <div ng-if="serverAssignDialogData.type == 'edit'">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">Token Server</label>
                            <div class="col-sm-4">
                                <p class="form-control-static">{{serverAssignDialogData.serverData.currentServer}}</p>
                            </div>

                            <label class="col-sm-2 control-label">Server 端口</label>
                            <div class="col-sm-3">
                                <input class="form-control highlight-border" max="65535" min="1" ng-disabled="!serverAssignDialogData.serverData.belongToApp"
                                       placeholder='请输入 Token Server 端口'
                                       ng-model='serverAssignDialogData.serverData.serverPort'
                                       type="number"/>
                            </div>
                        </div>
                        <div class="form-group" ng-if="serverAssignDialogData.serverData.belongToApp">
                            <label class="col-sm-2 control-label"
                                   title="server 最大允许的总 QPS，注意 embedded 模式下不要设的太大">最大允许 QPS</label>
                            <div class="col-sm-3">
                                <input class="form-control highlight-border" max="200000" min="0" ng-model='serverAssignDialogData.serverData.maxAllowedQps'
                                       placeholder='请输入 server 最大允许 QPS'
                                       type="number"/>
                            </div>
                        </div>
                    </div>

                    <div ng-if="serverAssignDialogData.type == 'add'">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">机器类型</label>
                            <div class="col-sm-4">
                                <div align="center" class="form-control highlight-border">
                                    <input checked name="strategy" ng-model='serverAssignDialogData.serverData.serverType' type="radio"
                                           value="0"/>&nbsp;应用内机器&nbsp;&nbsp;
                                    <input name="strategy" ng-model='serverAssignDialogData.serverData.serverType' type="radio"
                                           value="1"/>&nbsp;外部指定机器
                                </div>
                            </div>

                            <div ng-if="serverAssignDialogData.serverData.serverType == 1">
                                <div class="col-sm-6">
                                    <p class="form-control-static text-primary" style="font-size: x-small;">若指定外部
                                        server，请先在相应页面对外部 server 进行配置，然后在此页面指定。</p>
                                </div>
                            </div>
                        </div>

                        <div ng-if="serverAssignDialogData.serverData.serverType == 0">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">选择机器</label>
                                <div class="col-sm-4">
                                    <select class="form-control"
                                            ng-change="onCurrentServerChange()"
                                            ng-model="serverAssignDialogData.serverData.currentServer"
                                            ng-options="machineId for machineId in remainingMachineList"></select>
                                </div>

                                <label class="col-sm-2 control-label">Server 端口</label>
                                <div class="col-sm-3">
                                    <input class="form-control highlight-border" max="65535" min="1" ng-model='serverAssignDialogData.serverData.serverPort'
                                           placeholder='请输入 Token Server 端口号'
                                           type="number"/>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"
                                       title="server 最大允许的总 QPS，注意 embedded 模式下不要设的太大">最大允许
                                    QPS</label>
                                <div class="col-sm-3">
                                    <input class="form-control highlight-border" max="200000" min="0" ng-model='serverAssignDialogData.serverData.maxAllowedQps'
                                           placeholder='请输入 server 最大允许 QPS'
                                           type="number"/>
                                </div>
                            </div>
                        </div>

                        <div ng-if="serverAssignDialogData.serverData.serverType == 1">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">Server IP</label>
                                <div class="col-sm-4">
                                    <input class="form-control highlight-border" ng-model='serverAssignDialogData.serverData.currentServer'
                                           placeholder='请输入独立的 Token Server IP'
                                           type="text"/>
                                </div>

                                <label class="col-sm-2 control-label">Server 端口</label>
                                <div class="col-sm-3">
                                    <input class="form-control highlight-border" max="65535" min="1" ng-model='serverAssignDialogData.serverData.serverPort'
                                           placeholder='请输入 Token Server 端口号'
                                           type="number"/>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>

                <!-- assign form start -->
                <form class="form-inline" ng-if="serverAssignDialogData.serverData.currentServer" role="form"
                      style="margin-top: 30px; margin-left: 20px; text-align: center;">
                    <div>
                        <div class="form-group">
                            <div class="col-sm-12">
                                <label class="control-label" style="width: 220px; text-align: center;">请从中选取
                                    client：</label>
                                <div>
                                    <select class="form-control" multiple="multiple" ng-model="tmp.curRemainingClientChosen"
                                            ng-options="ip for ip in remainingMachineList | filter: notChosenServer"
                                            size="8" style="width: 100%;">
                                    </select>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-sm-12">

                                <button class="btn btn-outline-primary" ng-click="moveToRemainingSharePool()"
                                        type="button">←
                                </button>
                                <button class="btn btn-outline-primary" ng-click="moveToServerGroup()"
                                        type="button">→
                                </button>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-sm-12">
                                <label class="control-label" style="width: 200px; text-align: center;">已选取的 client
                                    列表</label>
                                <div>
                                    <select class="form-control" multiple="multiple" ng-model="tmp.curClientChosen"
                                            ng-options="ip for ip in serverAssignDialogData.serverData.clientSet"
                                            size="8" style="width: 100%;"></select>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="separator"></div>
            <div clss="row" style="margin-top: 20px;">
                <button class="btn btn-outline-danger"
                        ng-click="serverAssignDialog.close()"
                        style="float:right; height: 30px;font-size: 12px;margin-left: 10px;">取消
                </button>
                <button class="btn btn-outline-success"
                        ng-click="saveAssignForDialog()"
                        style="float:right; height: 30px;font-size: 12px;margin-left: 10px;">{{serverAssignDialogData.confirmBtnText}}
                </button>
            </div>
        </div>
    </div>
</div>
